from typing import List

class ListNode:
    def __init__(self, val:any, depth:int = 0, cost: int = 0, parent = None, cousin= None, next_n = None):

        self._val = val
        self._depth = depth
        self._cost = cost
        self._parent = parent
        self._cousin = cousin
        self._next = next_n

    def getCost(self) -> int:
        return self._cost
    
    def getDepth(self) -> int:
        return self._depth
    
    def getCost(self) -> int:
        return self._cost
    
    def getVal(self):
        return self._val

    def getParent(self) -> __init__:
        return self._parent

    def getCousin(self) -> __init__:
        return self._cousin

    def getNext(self) -> __init__:
        return self._next

    def getFn(self) -> int:
        return self._cost + self._depth

    def getRoad(self) -> List[__init__]:
        road = list()
        now = self
        while now.getParent() is not None:
            road.append(now)
            now = now.getParent()
        road.append(now)
        road.reverse()
        return road

    def setNext(self, next_n):
        self._next = next_n

    def setCost(self, cost):
        self._cost = cost

    def setDepth(self, depth):
        self._depth = depth

    def setCousin(self, cousin):
        self._cousin = cousin